package itstudio.instructor.ui;

import itstudio.instructor.adapter.StatPagerAdapter;
import itstudio.instructor.widget.PagerSlidingTabStrip;
import java.util.ArrayList;
import com.easemob.chatuidemo.R;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.View.OnClickListener;



/** 
* @Description: my appt
* @author wang
* @date 2015-1-13 上午1:14:21 
*/
public class UserListActivity extends FragmentActivity {


	private PagerSlidingTabStrip tabs;
	private ViewPager pager;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_user_list);
		findViews();
		init();
		setListeners();

	}

	protected void findViews() {
		pager = (ViewPager) findViewById(R.id.pager);
		tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
	}

	protected void init() {
		ArrayList<Fragment> fragments = new ArrayList<Fragment>();
		fragments.add(new UserTeacherFragment());
		fragments.add(new UesrPubFragment());
		final String[] titles = {"教师","公众号" };
		pager.setAdapter(new StatPagerAdapter(getSupportFragmentManager(), fragments, titles));
		tabs.setViewPager(pager);
		tabs.setShouldExpand(true);
	}
	protected void setListeners() {
		
		findViewById(R.id.top_back).setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				finish();
			}
		});
		findViewById(R.id.srarch).setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				startToSearchActivity();
			}
		});
	}
	private void startToSearchActivity(){
		Intent intent = new Intent(UserListActivity.this, UserSearchActivity.class);
		startActivityForResult(intent, 1000);
		//overridePendingTransition(R.anim.animationb,R.anim.animationa);
	}

}
